<template>
  <el-carousel height="400px" :interval="5000" arrow="always">
    <el-carousel-item v-for="item in bannerList" :key="item.id">
      <a :href="item.link">
        <img :src="item.image" alt="">
      </a>
    </el-carousel-item>
  </el-carousel>
</template>


<script>
  export default {
    name: "Banner",
    data() {
      return {
        bannerList: []
      }
    },
    created() {
      this.$axios.get(this.$settings.Host + '/home/banner/')
      .then(res => {
        this.bannerList = res.data;
      })
      .catch(err => console.log(err))
    }
  }
</script>

<style>
  .el-carousel__item img {
    width: 100%;
    height: 400px;
  }
  .el-carousel__item:nth-child(2n) {
    background-color: #99a9bf;
  }

  .el-carousel__item:nth-child(2n+1) {
    background-color: #d3dce6;
  }
</style>
